package com.ct.controller;

import cn.hutool.core.lang.Console;
import cn.hutool.system.HostInfo;
import cn.hutool.system.SystemUtil;
import lombok.SneakyThrows;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.net.InetAddress;

@RestController
@RequestMapping("/port")
public class ProtController {

    @SneakyThrows
    @GetMapping("getAddress")
    public String getAddress(){

        HostInfo hostInfo = SystemUtil.getHostInfo();
        Console.log("hostInfo->{}",hostInfo.getAddress());

        //本地主机的地址
        InetAddress inetAddress = InetAddress.getLocalHost();
        Console.log("inetAddress->{}",inetAddress.getHostAddress());
        return "aaa";
    }
}
